home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / RELEASE.ZIP / sub_arctic / test / app_test.java < prev    next >
Encoding:
Java Source  |  1996-10-04  |  3.0 KB  |  100 lines

  1. /*
  2.  * This shows how to build a sub_arctic application.
  3.  * 
  4.  * NOTE: This is NOT a member of the package sub_arctic.test so
  5.  * you would need to make sure that . is in your class path, get
  6.  * in the test directory and then do "java app_test". I did this
  7.  * to make it easier for people to see how to write their own 
  8.  * apps.
  9.  */
  10. import sub_arctic.input.*;
  11. import sub_arctic.lib.*;
  12. import sub_arctic.output.*;
  13. import sub_arctic.constraints.std_function;
  14.  
  15. public class app_test extends interactor_app {
  16.   /**
  17.    * This is the main of the program, and all it should do is create
  18.    * a new instance of its own type,initialize it, then return.
  19.    */
  20.   public static void main(String[] argv) {
  21.     app_test at=new app_test(argv);
  22.     at.initialize();
  23.     /* done */
  24.   }
  25.   /**
  26.    * You need to propagate the String[] to the superclass' constructor
  27.    */
  28.   public app_test(String[] argv) { super(argv);}
  29.   /**
  30.    * Parse the command line arguments here. For this test, I just 
  31.    * echo them to the terminal.
  32.    */
  33.   public boolean parse_arguments(String[] argv) {
  34.     for (int i=0; i<argv.length; ++i) {
  35.       System.out.println("argv["+i+"] = " + argv[i]);
  36.       /* you must return true or the system thinks the arguments were bad */
  37.     }
  38.     return true;
  39.   }
  40.   /**
  41.    * Application level data structure initialization.
  42.    */
  43.   public void app_initialize() {
  44.     super.app_initialize();
  45.     System.out.println("Should initialize application data structures here.");
  46.   }
  47.   /**
  48.    * Frame initialization.
  49.    */
  50.   public void frame_initialize() {
  51.     interactor_frame f;
  52.     super.frame_initialize();
  53.     System.out.println("Initializing the window system....");
  54.     /* make a new frame with the hello world button in it */
  55.     f=new hello_frame();
  56.     /* put it on screen */
  57.     f.show();
  58.   }
  59.   
  60. }
  61.  
  62. /**
  63.  * This is the other frame that we are embedding in this application.
  64.  */
  65. class hello_frame extends interactor_frame {
  66.   /**
  67.    * Constructor
  68.    */
  69.   public hello_frame() {
  70.     super("Hello!",null);
  71.   }
  72.   /**
  73.    * Build the UI
  74.    */
  75.   public void build_ui(base_parent_interactor top) {
  76.     button hello_button;
  77.     /* put the button at 10, 10 and use 10 and 10 as the border sizes */
  78.     hello_button=new button("Hello World!", null);
  79.     top.add_child(hello_button);
  80.     hello_button.set_x_constraint(std_function.centered(PARENT.X2(),0));
  81.     hello_button.set_y_constraint(std_function.centered(PARENT.Y2(),0));
  82.   }
  83. }
  84. /*=========================== COPYRIGHT NOTICE ===========================
  85.  
  86. This file is part of the subArctic user interface toolkit.
  87.  
  88. Copyright (c) 1996 Scott Hudson and Ian Smith
  89. All rights reserved.
  90.  
  91. The subArctic system is freely available for most uses under the terms
  92. and conditions described in 
  93.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  94. and appearing in full in the lib/interactor.java source file.
  95.  
  96. The current release and additional information about this software can be 
  97. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  98.  
  99. ========================================================================*/
  100.